package models.weixin;

import models.BaseModel;
import product.Product;

import javax.persistence.*;

/**
 * 充值记录
 */

@Entity
@Table(name = "recharge_historys")
public class RechargeHistory  extends BaseModel{


    /**
     * 微信用户名称
     */
    @JoinColumn(name = "web_user_id")
    @ManyToOne
    public WebUser webUser;


    /**
     * 充值卡
     */
    @JoinColumn(name = "product_id")
    @ManyToOne
    public Product product;


    /**
     * 变动金额
     */
    @Column(name = "recharge_amount" ,columnDefinition = "decimal(15,2)")
    public Double rechargeAmount= 0d;


     /**
     * 变动之后的金额
     */
    @Column(name = "old_balance" ,columnDefinition = "decimal(15,2)")
    public Double balance;


    /**
     * 源头主业务id
     * 方便查询充值或者使用的原始记录
     *
     */
    @Column(name = "source_biz_id")
    public Long sourceBizId;

    /**
     * 源头业务编号
     */
    @Column(name = "source_biz_code")
    public String sourceBizCode;

    /**
     * 源头子业务id
     */
    @Column(name = "source_biz_item_id")
    public Long sourceBizItemId;


}
